Places the elements of an array into a single string, separated by the specified delimiter.
#include <Array.au3>
_ArrayToString ( $avArray, $sDelim [[, $iStart], $iEnd] )
Parameters
$avArray | The array to be converted into a string. |
$sDelim | The delimiter to separate each element with. |
$iStart | Optional (default to 0): An integer that specifies the element to start at in the array. |
$iEnd | Optional (Default to Ubound): An integer that specifies the element to end at in the array. |
Return Value
Success: | Returns a delimited string containing all elements in the array. |
Failure: | Returns an empty string. |
@Error: | 0 = No error. |
1 = $avArray isn't an array. | |
2 = $avArray has less than 2 elements or it has more than 1 dimension. | |
3 = $iStart isn't an integer. | |
4 = $iStart is < 0. | |
5 = $iEnd isn't an integer. | |
6 = $iEnd is < 0. | |
7 = $sDelim isn't a string | |
8 = $sDelim is an empty string. | |
9 = $sDelim has more than one delimiter. |
Remarks
This function is the opposite of the StringSplit function with the extension of being able to take a subset of all of the elements and placing just that subset into the string.
Related
_ArrayToClip, _FileReadToArray, StringSplit
Example
#include <Array.au3>
Dim $avArray[11], $I = 0
; Populate test array.
For $I = 0 to UBound( $avArray ) - 1
$avArray[$I] = Int( Random( -20000, 20000 ) )
Next
_ArrayDisplay( $avArray, "_ArrayToString() Test" )
Dim $sArrayString = _ArrayToString( $avArray,@TAB, 1, 7 )
MsgBox( 4096, "_ArrayToString() Test", $sArrayString )
Exit